#include "../common.h"

class Solution
{
public:
    string longestCommonPrefix(vector<string> &strs)
    {
        if (strs.size() < 1)
        {
            return "";
        }

        string retStr;

        for (int i = 0; i < strs[0].length(); i++)
        {
            char c = strs[0][i];
            for (int j = 1; j < strs.size(); j++)
            {
                if (i >= strs[j].length() || c != strs[j][i])
                {
                    return retStr;
                }
            }
            retStr += c;
        }

        return retStr;
    }
};
